package com.platform.provider.config;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

@Slf4j
@Configuration
@NacosPropertySource(dataId = "commonconfig", autoRefreshed = true)
public class CommonConfig {

    @NacosValue("useLocalCache")
    private String useLocalCache;

    @NacosValue("testNacos")
    private String testNacos;

    @Bean("name=commonConfig")
    public CommonConfig getCommonConfig(){
        log.info("into create commonConfig:"+useLocalCache+","+testNacos);
        CommonConfig commonConfig = new CommonConfig();
        commonConfig.useLocalCache = useLocalCache;
        commonConfig.testNacos = testNacos;
        return commonConfig;
    }

}
